#!/usr/bin/python
# -*- coding: utf-8 -*


def binarySearch(target, li):
    left = 0
    right = len(li) - 1
    while left <= right:
        mid = (left + right) // 2
        if target == li[mid]:
            return mid
        elif target < li(mid):
            right = mid - 1
        else:
            left = mid + 1
    return -1